import com.sun.j3d.loaders.*; 
import com.sun.j3d.loaders.lw3d.Lw3dLoader;
import com.sun.j3d.loaders.objectfile.ObjectFile; 

public class LoaderFactory 
{
    public static Loader getLightwaveLoader() 
    {
        return new Lw3dLoader();
    }

    public static Loader getWavefrontLoader() 
    {
        return new ObjectFile(ObjectFile.RESIZE | ObjectFile.STRIPIFY | ObjectFile.TRIANGULATE); 
    }

    public static Loader getLoaderForModel(String path) throws UnsupportedOperationException 
    {
        
        if (path.endsWith("obj")) 
        {
            return new ObjectFile(ObjectFile.RESIZE | ObjectFile.STRIPIFY | ObjectFile.TRIANGULATE); 
        } 
        else if (path.endsWith("lwo")) 
        {
            return new Lw3dLoader(); 
        }
        else
        {
            throw new UnsupportedOperationException("Unknown model type");
        }
    }
}
